package cn.wolfcode;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import javax.swing.*;

/**
 * @Description: 订单(消费者)启动类
 * @Author: 伍家钰
 * @Date: 2020/8/28 18:35
 * @Version: 1.0
 */
@SpringBootApplication
// 注册客户端
@EnableEurekaClient
// 使用Feign做远程调用,替代ribbon
@EnableFeignClients
// 引入hystrix对调用不同服务器功能出错时提供熔断,延时的功能
@EnableCircuitBreaker
public class OrderMain8090 {
    /*@Bean
    //负载均衡:开启负载均衡
    @LoadBalanced
    public RestTemplate restTemplate() {
        *//*
     *默认使用HttpUrlConnection客户端工具,如果要使用其他的就在()中以参数形式传入
     * HTTPURLController:JDK自带的客户端工具
     * OkHttp:
     * HttpClient:apache提供的客户端工具
     *//*
        return new RestTemplate();
    }*/

    public static void main(String[] args) {
        SpringApplication.run(OrderMain8090.class, args);
    }
}
